﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using SydEnergiPrototype.Kernel;
using SydEnergiPrototype.Logic;
using SydEnergiPrototype.ViewModel;

namespace SydEnergiPrototype.View
{
    public partial class DataView : PhoneApplicationPage
    {
        public IDataViewModel ViewModel { get; private set; }
        public DataView()
        {
            InitializeComponent();
            this.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);
        }

        protected override void OnFragmentNavigation(System.Windows.Navigation.FragmentNavigationEventArgs e)
        {
            base.OnFragmentNavigation(e);

            ViewModel = IoCContainer.Get<IDataViewModel>(e.Fragment);
            LayoutRoot.DataContext = ViewModel;
        }

        private void Save_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/View/FinalizeEditView.xaml", UriKind.Relative));
        }
    }
}